<template>
  <div id="header">
    <el-menu class="menu" background-color="#f8f8f8" :default-active="$route.path" router mode="horizontal">
      <el-menu-item
        v-for="route in routes"
        :key="route.path"
        :index="route.path"
        :class="$route.path===route.path?'is-active':''"
      >
        <i :class="route.icon" />
        {{ route.title }}
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  name: 'Header',
  data() {
    return {
      routes: [
        { path: '/home', title: '主页', icon: 'el-icon-s-operation' },
        { path: '/category', title: '分类', icon: 'el-icon-star-off' },
        { path: '/archive', title: '归档', icon: 'el-icon-s-fold' },
        { path: '/friends', title: '友链', icon: 'el-icon-link' }
        // { path: '/login', title: 'Login', icon: 'el-icon-user' }
      ]
    }
  }
}
</script>

<style scoped>
a {
  text-decoration: none;
}

#header {
  position: sticky;
  top: 0;
  z-index: 9999;
}

.menu {
  border: none;
}
</style>
